<nz-modal [(nzVisible)]="isVisible" [nzWidth]="modalWidth" (nzOnCancel)="onBack()" [nzStyle]="{'top': '50px'}">
  <div *nzModalTitle>{{ title }}</div>
  <ng-container *nzModalContent>
    <form [formGroup]="jobDescriptionForm" (keydown.enter)="$event.preventDefault()">
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="enterpriseName" nzRequired>企业名称</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择企业名称'">
              <nz-input-group nzSearch [nzAddOnAfter]="enterpriseNameSuffixIconButton">
                <input nz-input formControlName="enterpriseName" placeholder="请选择企业名称" readonly />
              </nz-input-group>
              <ng-template #enterpriseNameSuffixIconButton>
                <button nz-button nzType="primary" nzSearch (click)="findEnterprise()"><nz-icon nzType="search" /></button>
              </ng-template>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="jobTitle" nzRequired>岗位名称</nz-form-label>
            <nz-form-control [nzErrorTip]="'请输入岗位名称'">
              <input nz-input formControlName="jobTitle" placeholder="请输入岗位名称" maxlength="255"/>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="departmentName" nzRequired>部门名称</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择部门名称'">
              <nz-input-group nzSearch [nzAddOnAfter]="departmentNameSuffixIconButton">
                <input nz-input formControlName="departmentName" placeholder="请选择部门名称" readonly />
              </nz-input-group>
              <ng-template #departmentNameSuffixIconButton>
                <button nz-button nzType="primary" nzSearch (click)="findDepartment()"><nz-icon nzType="search" /></button>
              </ng-template>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="workLocation" nzRequired>工作地点</nz-form-label>
            <nz-form-control [nzErrorTip]="'请输入工作地点'">
              <input nz-input formControlName="workLocation" placeholder="请输入工作地点" maxlength="255"/>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="jobType" nzRequired>岗位类型</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择岗位类型'">
              <nz-select formControlName="jobType">
                <nz-option nzLabel="全职" [nzValue]="10"></nz-option>
                <nz-option nzLabel="兼职" [nzValue]="20"></nz-option>
                <nz-option nzLabel="实习" [nzValue]="30"></nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="salaryRange" nzRequired>薪资范围</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择薪资范围'">
              <nz-select formControlName="salaryRange">
                <nz-option nzLabel="3000~5000" [nzValue]="1"></nz-option>
                <nz-option nzLabel="5001~10000" [nzValue]="2"></nz-option>
                <nz-option nzLabel="10001~20000" [nzValue]="3"></nz-option>
                <nz-option nzLabel="20001~30000" [nzValue]="4"></nz-option>
                <nz-option nzLabel="30000以上" [nzValue]="5"></nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="postingDate">发布日期</nz-form-label>
            <nz-form-control >
              <nz-date-picker formControlName="postingDate" nzFormat="yyyy-MM-dd"></nz-date-picker>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="closingDate">截止日期</nz-form-label>
            <nz-form-control >
              <nz-date-picker formControlName="closingDate" nzFormat="yyyy-MM-dd"></nz-date-picker>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="headCount" nzRequired>招聘人数</nz-form-label>
            <nz-form-control [nzErrorTip]="'请输入招聘人数'">
            <nz-input-number formControlName="headCount" [nzMin]="1" [nzMax]="1" />
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="status" nzRequired>状态</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择状态'">
              <nz-select formControlName="status">
                <nz-option nzLabel="开放" [nzValue]="10"></nz-option>
                <nz-option nzLabel="关闭" [nzValue]="20"></nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="22">
          <nz-form-item>
            <nz-form-label [nzSpan]="3" nzFor="responsibilities">岗位职责</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择岗位职责'">
              <textarea nz-input formControlName="responsibilities" placeholder="请输入岗位职责" maxlength="65535"></textarea>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="22">
          <nz-form-item>
            <nz-form-label [nzSpan]="3" nzFor="requirement">岗位要求</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择岗位要求'">
              <textarea nz-input formControlName="requirement" placeholder="请输入岗位要求" maxlength="65535"></textarea>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
    </form>
  </ng-container>
  <div *nzModalFooter>
    <div class="form-button-container">
      <button nz-button nzType="primary" (click)="onSave()" [nzLoading]="saveLoading">保存</button>
      <button nz-button nzType="default" (click)="onReset()" [nzLoading]="saveLoading">重置</button>
      <button nz-button nzType="default" (click)="onBack()">关闭</button>
    </div>
  </div>
</nz-modal>
<enterprise-selector (enterpriseSelectedEvent)="handleEnterpriseSelectedEvent($event)"></enterprise-selector>
<department-selector (departmentSelectedEvent)="handleDepartmentSelectedEvent($event)"></department-selector>
